﻿using BLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebAppi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class FangHaoController : ControllerBase
    {
        public FangHaoController(FangHao_BLL bll)
        {
            Bll = bll;
        }

        public FangHao_BLL Bll { get; }

        /// <summary>
        /// 房号添加
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        [HttpPost("FangHaoAdd")]
        public IActionResult FangHaoAdd(FangHao_Model m)
        {
            var m1=Bll.FangHaoAdd(m);
            return Ok(new
            {
                data = m1
            });
        }

        /// <summary>
        /// 房号列表
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="CName"></param>
        /// <returns></returns>
        [HttpGet("FangHaoShow")]
        public IActionResult FangHaoShow(string? Name, string? CName)
        {
           var m=Bll.FangHaoShow(Name, CName);
            return Ok(new
            {
                data = m
            });
        }

        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="ZT"></param>
        /// <returns></returns>
        [HttpPost("FangHaoZT")]
        public IActionResult FangHaoZT(int id, string? ZT)
        {
           var m= Bll.FangHaoZT(id, ZT);
            return Ok(new
            {
                data = m
            });
        }

    }
}
